home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 21
/
Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso
/
Aminet
/
comm
/
mail
/
YAMscripts.lha
/
Tagline2.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-01-04
|
3KB
|
83 lines
/* Tagline2.rexx
v1.0 03-Jan-97
-Copy this script to yam:rexx, edit the tagfile names and set the YAM editor to
'sys:rexxc/rx yam:rexx/tagline2.rexx' and you are ready to run!
-Pressing editor-button doesn't start external editor anymore, instead it adds
a tagline!
-Uses multiple tagline files to cut down the loading time, if you
have lots of taglines
-Tagfile should contain taglines separated by one separator line. You
can define the separator yourself.
-If you wish to add empty lines before tagline, add NLs to the end of pretag
As always comments and bug reports are welcomed at knikulai@utu.fi
*/
options results
parse arg message
call addlib('rexxreqtools.library',0,-30)
NL='0a'x /* Newline */
/*
** Change these values to your liking
*/
tagfiles=11 /* Number of tagfiles */
tagfile.1='packed:txt/taglines_1' /* Their names */
tagfile.2='packed:txt/taglines_2'
tagfile.3='packed:txt/taglines_3'
tagfile.4='packed:txt/taglines_4'
tagfile.5='packed:txt/taglines_5'
tagfile.6='packed:txt/taglines_6'
tagfile.7='packed:txt/taglines_7'
tagfile.8='packed:txt/taglines_8'
tagfile.9='packed:txt/taglines_9'
tagfile.10='packed:txt/taglines_10'
tagfile.11='packed:txt/taglines_11'
separator='$' /* This alone in a line means break between tags */
pretag=NL /* Your Custom line to go before your tagline */
call random(,,time(s)) /* Let's make things really random */
/* let's first read all taglines */
tc=1 /* How many tags are there? */
tags.1='' /* Set the first to empty */
tagnum=random(1,tagfiles) /* Select a tagfile */
if open(in,tagfile.tagnum,'R') then do /* A tagfile was found */
do until eof(in) /* Read everything in it */
rivi=readln(in) /* Read one line */
if rivi=separator then do /* If the line was separator line */
tc=tc+1 /* Next nonblank line will begin a new tag.. */
tags.tc='' /* which will be empty first */
end
else /* The line was not a separator */
tags.tc=tags.tc || rivi || NL /* Add it to the current tagline */
end /* do until eof*/
call close(1) /* Close tagfile */
end
else do
address 'YAM' 'Request "Could not open ' ||tagfile.tagnum||'!" "OK"'
exit
end
if tags.tc='' then tc=tc-1 /* Let's just be sure there are no blanks... */
if open(out,message,'A') then do/* Open message file for appending */
i=rnd(tc) /* Get a random number 1..tc */
if pretag~='' then
call writeln(out,pretag)/* Add customized line before Tagline */
call writeln(out,tags.i) /* Write the tagline */
call close(out) /* Close message file */
end
exit
rnd:
/* random can't handle big numbers... This will create a big number and get
** modulo n+1. This needs editing, if you have more than 30999 taglines... :-)
*/
parse arg n
r=1+(1000*random(1,30)+random(1,999))//n
return r